<template>
  <edit-page
      :show="editShow"
      :mode="props['mode']"
      :data="editData"
      @close="editShow=false"
      @refreshData="emit('refreshData')"
      @changeData="changeData"
  />
  <emp-table
      v-if="props['mode']===0"
      :emp-info="props['data']"
      @showCreatePage="emit('showCreatePage')"
      @edit="edit"
  />
  <dep-info
      v-else-if="props['mode']===1"
      :dep-info="props['data']"
      @showCreatePage="emit('showCreatePage')"/>
  <trans-info
      v-else-if="props['mode']===2"
      :trans-info="props['data']" />
</template>

<script setup>
import EmpTable from "./empTable.vue";
import DepInfo from "./depTable.vue"
import TransInfo from './transTable.vue'
import EditPage from './editPage.vue'
import {ref} from "vue";
const props=defineProps(['mode','data'])
const emit=defineEmits(["showCreatePage",'refreshData'])
const editShow=ref(false)
const editData=ref(null)
const edit=(i,data)=>{
  editData.value=Object.assign({},data)
  editShow.value=true

}
const changeData=(data)=>{
  editData.value=data
}
</script>

<style scoped>

</style>